package com.oa.web;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;
import com.oa.bean.SysFun;
import com.oa.biz.impl.SysFunServiceImpl;

@WebServlet("/SubMenu")
public class SubMenuServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		
		String pId=request.getParameter("id");
		String roleId=request.getParameter("roleId");
		List<SysFun> menus=new SysFunServiceImpl().getSubMenus(pId,roleId);
		response.getWriter().write(new Gson().toJson(menus));
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
